/** A door entity.
*/
function DoorEntity()
{
	// 0 = open, 1 = closed, >1 = locked, status = lockId
	this.status = 1;
	this._updateState();
}
DoorEntity.prototype = new Entity("door", "+", Color.white, null, true, true);
DoorEntity.prototype.use = function(user, target)
{
	var parent = this.parent;
	if(parent != null)
		parent.removeEntity(this);
	if(this.status < 1)
		this.status = 1;
	else if(this.status == 1)
		this.status = 0;
	// TODO Support locked doors
	this._updateState();
	if(parent != null)
		parent.addEntity(this);
}
DoorEntity.prototype._updateState = function()
{
	this.character = this.status > 0 ? "+" : "/";
	this.blockVis = this.blockWalk = this.status > 0 ? true : false;
}
ron.registerCtor(DoorEntity, "DoorEntity");
